package com.sphd.restaurantsystem.presenter;


import com.android.volley.VolleyError;
import com.sphd.restaurantsystem.info.StaffInfo;
import com.sphd.restaurantsystem.model.StaffModelImpl;
import com.sphd.restaurantsystem.view.StaffView;

import java.util.List;

/**
 * Created by Hu on 2016/12/22
 */

public class StaffPresenterImpl implements StaffPresenter {
    StaffModelImpl staffModel;
    StaffView staffView;

    public StaffPresenterImpl(StaffView staffView) {
        this.staffView = staffView;
        staffModel = new StaffModelImpl();
    }

    @Override
    public void addData(String url) {
        staffView.showLoading();
        staffModel.sendUrl(url, this);
    }

    @Override
    public void sendError(VolleyError error) {
        staffView.dissLoading();
    }

    @Override
    public void recList(List<StaffInfo> staffInfoList) {
        staffView.recList(staffInfoList);
        staffView.dissLoading();
    }

    @Override
    public void delUrl(String url) {
        staffModel.delUrl(url, this);
    }

    @Override
    public void recRes(int res) {
        staffView.recRes(res);
        staffView.dissLoading();
    }
}